/*------------------------------------*\
    #PATTERN
\*------------------------------------*/

/**
* Pattern
* 1) This is an individual pattern that appears in the "view all" template.
* It contains pattern title and toggle to view more information, such as
* description, lineage, code, etc.
* 2) Prevents absolutely-positioned elements from floating to the top
* 3) Prevents floated patterns from floating wraps
*/
.pl-c-pattern {
  margin-bottom: $pl-doublespace;
  position: relative; /* 2 */
  clear: both; /* 3 */
}

/**
* Pattern Header
*/
.pl-c-pattern__header {
  position: relative;
  padding: 0.5rem 0 0;
  line-height: 1.3;
  font-size: 90%;
  color: $pl-color-gray-55;

  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;

  &:empty {
    padding: 0;
  }
}

/**
 * Pattern Title
 */
.pl-c-pattern__title {
  font-family: $pl-font !important;
  font-size: 0.85rem !important;
  line-height: 1 !important;
  font-weight: normal !important;
  margin: 0 !important;
  padding: 0 !important;
  text-transform: capitalize !important;
}

/**
 * Pattern Title Link
 * 1) Vertically align pattern label and pattern state badge
 */
.pl-c-pattern__title-link {
  display: inline-flex; /* 1 */
  align-items: center; /* 1 */
  padding: $pl-pad 0 0.3rem;
  color: $pl-color-gray-55 !important;
  text-decoration: none;
  cursor: pointer;

  &:hover,
  &:focus {
    color: $pl-color-black !important;
  }
}

/**
* Pattern Extra Toggle Button
* 1) This is the button that twirls down extra pattern info
*/
.pl-c-pattern__extra-toggle {
  font-size: 0.8rem;
  margin-bottom: -1px;
  padding: 0.4rem 0.5rem;
  padding-right: 1.75rem;
  color: $pl-color-gray-55;
  background-color: transparent;
  cursor: pointer;
  font-weight: normal;
  transition: all $pl-animate-quick ease-out;
  font-family: $pl-font;
  border-color: #ddd;
  border-width: 1px; // fix for different browser defaults
  border-style: solid; // fix for different browser defaults (ex. Safari)
  display: flex;
  align-items: center;

  &:hover,
  &:focus,
  &.pl-is-active {
    background-color: $pl-color-gray-02;
    color: $pl-color-black;
  }

  &:focus {
    outline: 1px dotted $pl-color-gray-70;
    outline-offset: -1px;
  }

  &.pl-is-active {
    border-bottom-color: $pl-color-gray-02;
  }
}

.pl-c-pattern__toggle-icon {
  height: 0.9rem;
  width: 0.9rem;
  display: inline-block;
  vertical-align: middle;
  position: absolute;
  right: 0.625rem;
  transition: opacity 0.1s linear;
}

.pl-c-pattern__toggle-icon--expand {
  z-index: 1;

  .pl-is-active & {
    opacity: 0;
  }
}

.pl-c-pattern__toggle-icon--collapse {
  opacity: 0;
  z-index: 2;
  height: 1rem;
  width: 1rem;

  .pl-is-active & {
    opacity: 1;
  }
}

.pl-c-pattern__extra-toggle-text ~ svg {
  margin-left: 0.25rem;
}

.pl-c-pattern__extra-toggle-text--collapse {
  display: none;

  .pl-is-active & {
    display: inline-block;
  }
}

.pl-c-pattern__extra-toggle-text--expand {
  display: inline-block;

  .pl-is-active & {
    display: none;
  }
}

/**
* Pattern Extra
* 1) This is the info panel that contains extra pattern info
* like pattern description, lineage, code, and more
*/
.pl-c-pattern__extra {
  background-color: $pl-color-gray-02;
  border-top: 1px solid $pl-color-gray-13;
  margin-bottom: $pl-space;
  overflow: hidden;
  max-height: 1px;
  position: relative;
  transition: all $pl-animate-quick ease-out;

  &.pl-is-active {
    border: 1px solid $pl-color-gray-13;
    border-radius: $pl-border-radius-med;
    border-top-right-radius: 0;
    max-height: 9999px;
  }
}
